//
//  ForgetViewController.swift
//  BusinessIOS
//
//  Created by Rain on 2018/11/3.
//  Copyright © 2018 XingJian Li. All rights reserved.
//

import UIKit

class ForgetViewController: UIViewController {
    
    var phoneImageView : UIImageView!
    var phoneTextField : UITextField!
    
    var SendButton : UIButton!
    
    var bgView:UIView!

    var PasswordImageView : UIImageView!
    var PasswordTextField : UITextField!
    
    var bgView1:UIView!
    
    
    
    
    var NextButton : UIButton!

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = bgGrayColor;
        navigationItem.title="忘记密码"
        //手机号
        
        phoneImageView = UIImageView(image: UIImage(named: "phone"))
        
        self.view.addSubview(phoneImageView)
        
        
        phoneTextField = UITextField()
        //设置边框样式为圆角矩形
        phoneTextField.borderStyle = UITextBorderStyle.none
        phoneTextField.placeholder = "手机号"
        self.view.addSubview(phoneTextField)
        
        bgView = UIView()
        bgView.backgroundColor = UIColor.gray
        self.view.addSubview(bgView)
        
        
        
        
        SendButton = UIButton()
        //背景颜色
        SendButton.backgroundColor = UIColor.blue
        SendButton.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        SendButton.setTitle("发送验证码", for: .normal )
        SendButton.layer.cornerRadius = 10
        SendButton.layer.masksToBounds = true
//
//        LoginButton.addTarget(self,action:#selector(LoginButtonClick), for: .touchUpInside)
        self.view.addSubview(SendButton)
        
        
        
        //密码
        
        
        PasswordImageView = UIImageView(image: UIImage(named: "Password"))
        
        self.view.addSubview(PasswordImageView)
        
        
        PasswordTextField = UITextField()
        //设置边框样式为圆角矩形
        PasswordTextField.borderStyle = UITextBorderStyle.none
        PasswordTextField.placeholder = "密码"
        self.view.addSubview(PasswordTextField)
        
        bgView1 = UIView()
        bgView1.backgroundColor = UIColor.gray
        self.view.addSubview(bgView1)
        
        
        
        NextButton = UIButton()
        //背景颜色
        NextButton.backgroundColor = UIColor.blue
        NextButton.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        NextButton.setTitle("下一步", for: .normal )
        NextButton.layer.cornerRadius = 10
        NextButton.layer.masksToBounds = true
        
        NextButton.addTarget(self,action:#selector(NextButtonClick), for: .touchUpInside)
        self.view.addSubview(NextButton)
        
        
        
        self.layoutView()
        
        
    }
    
    @objc func NextButtonClick() {
        print("下一步")
        
        let  ModifyVC =  ModifyViewController()
        
        self.navigationController?.pushViewController(ModifyVC , animated: true)
    }
    
    func layoutView()  {
        
        self.phoneImageView.snp.makeConstraints { (make) in
            make.top.equalTo(self.view.snp.top).offset(110)
            make.left.equalTo(self.view.snp.left).offset(10)
            make.width.equalTo(20)
            make.height.equalTo(20)
        }
        
        self.phoneTextField.snp.makeConstraints { (make) in
            make.top.equalTo(self.view.snp.top).offset(100)
            make.left.equalTo(self.phoneImageView.snp.right).offset(5)
            make.right.equalTo(self.view.snp.right).offset(-10)
            make.height.equalTo(40)
        }
        self.bgView.snp.makeConstraints { (make) in
            make.top.equalTo(self.phoneTextField.snp.bottom).offset(5)
            make.left.equalTo(self.view.snp.left).offset(10)
            make.right.equalTo(self.view.snp.right).offset(-10)
            make.height.equalTo(1)
        }
        
        self.PasswordImageView.snp.makeConstraints { (make) in
            make.top.equalTo(self.bgView.snp.bottom).offset(15)
            make.left.equalTo(self.view.snp.left).offset(10)
            make.width.equalTo(20)
            make.height.equalTo(20)
        }
        
        self.PasswordTextField.snp.makeConstraints { (make) in
            make.top.equalTo(self.bgView.snp.bottom).offset(5)
            make.left.equalTo(self.PasswordImageView.snp.right).offset(5)
            make.right.equalTo(self.view.snp.right).offset(-100)
            make.height.equalTo(40)
        }
        
        self.SendButton.snp.makeConstraints { (make) in
            make.top.equalTo(self.bgView.snp.bottom).offset(5)
            
            make.right.equalTo(self.view.snp.right).offset(-10)
            make.width.equalTo(80)
            make.height.equalTo(40)
        }
        
        self.bgView1.snp.makeConstraints { (make) in
            make.top.equalTo(self.PasswordTextField.snp.bottom).offset(5)
            make.left.equalTo(self.view.snp.left).offset(10)
            make.right.equalTo(self.view.snp.right).offset(-10)
            make.height.equalTo(1)
        }
        
        
        self.NextButton.snp.makeConstraints { (make) in
            make.top.equalTo(self.bgView1.snp.bottom).offset(20)
            make.left.equalTo(self.view.snp.left).offset(10)
            make.right.equalTo(self.view.snp.right).offset(-10)
            make.height.equalTo(40)
        }
        
        
        
    }


}
